<?php
/**
 * Created by PhpStorm.
 * 商品分类业务
 * User: caicm
 * Date: 2017/6/17
 * Time: 15:03
 */

namespace WMApi\Service;


use WMApi\Model\WmCategoryModel;

class CategoryService {

    /**
     * 获取分类列表
     * @return mixed
     */
    public function get_category_list(){
        $category_model = new WmCategoryModel();

        $category_list = $category_model->get_category_list(0);
        foreach ($category_list as $key=>$val){
            $category_list[$key]['category_list'] = $category_model->get_category_list($val['cat_id']);
            foreach ($category_list[$key]['category_list'] as $k=>$v){
                $category_list[$key]['category_list'][$k]['category_list'] = $category_model->get_category_list($v['cat_id']);
            }
        }

        return $category_list;

    }
}